home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / marionettemadness.swf / scripts / __Packages / XML2.as < prev    next >
Text File  |  2007-10-01  |  1KB  |  47 lines

  1. class XML2 extends XML
  2. {
  3.    var timeout = 7000;
  4.    function XML2(p_xml)
  5.    {
  6.       super(p_xml);
  7.       this.ignoreWhite = true;
  8.       this.contentType = "text/xml";
  9.       mx.events.EventDispatcher.initialize(this);
  10.    }
  11.    function load(p_url)
  12.    {
  13.       this.setTimeout();
  14.       super.load(p_url,"POST");
  15.    }
  16.    function sendAndLoad(p_url, p_targetXML)
  17.    {
  18.       this.setTimeout();
  19.       super.sendAndLoad(p_url,p_targetXML,"POST");
  20.    }
  21.    function setTimeout()
  22.    {
  23.       this.clearTimeout();
  24.       this.tmp_timeoutID = setInterval(this,"onTimeout",this.timeout);
  25.    }
  26.    function clearTimeout()
  27.    {
  28.       clearInterval(this.tmp_timeoutID);
  29.       delete this.tmp_timeoutID;
  30.    }
  31.    function onLoad(p_success)
  32.    {
  33.       if(!this.tmp_timeoutID)
  34.       {
  35.          return undefined;
  36.       }
  37.       this.clearTimeout();
  38.       this.dispatchEvent({target:this,type:"load",success:p_success});
  39.    }
  40.    function onTimeout()
  41.    {
  42.       this.clearTimeout();
  43.       this.status = -100;
  44.       this.dispatchEvent({target:this,type:"load",success:false});
  45.    }
  46. }
  47.